package org.smr.ministore.service.impl;

import java.util.List;

import org.apache.commons.lang3.ObjectUtils;
import org.blade.dao.base.BaseMapper;
import org.blade.utils.IdGenUtils;
import org.blade.utils.Pager;
import org.blade.service.base.AbstractService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.smr.ministore.dao.GoodsTypeMapper;
import org.smr.ministore.dao.GoodsTypeOrganMapper;
import org.smr.ministore.entities.GoodsType;
import org.smr.ministore.entities.GoodsTypeOrgan;
import org.smr.ministore.entities.vo.Assign2OrgansVO;
import org.smr.ministore.service.GoodsTypeService;

import org.springframework.beans.factory.annotation.Autowired;


import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service("goodsTypeServiceFacade")
@Transactional(readOnly = false)
public class GoodsTypeServiceFacade extends AbstractService<Long, GoodsType> implements GoodsTypeService {


    private static Logger logger = LoggerFactory.getLogger(GoodsTypeServiceFacade.class);

    @Resource(name = "goodsTypeServiceImpl")
    private GoodsTypeService goodsTypeService;

    @Autowired
    public GoodsTypeServiceFacade(BaseMapper<Long, GoodsType> mapper) {
        super(mapper);
    }

    public int save(GoodsType entity) {
        return goodsTypeService.save(entity);
    }

    public int updateById(GoodsType id) {
        return goodsTypeService.updateById(id);
    }

    @Transactional(readOnly = true)
    public GoodsType queryById(Long id) {
        return goodsTypeService.queryById(id);
    }

    public int deleteById(Long id) {
        return goodsTypeService.deleteById(id);
    }

    @Transactional(readOnly = true)
    public Pager<GoodsType> paginate(GoodsType entity, Long pageSize, Long pageNum) {
        return this.goodsTypeService.paginate(entity, pageSize, pageNum);
    }

    public int batchSave(List<GoodsType> entities) {
        return this.goodsTypeService.batchSave(entities);
    }


    public int batchModify(List<GoodsType> entities) {
        return this.goodsTypeService.batchModify(entities);
    }


    public int deleteByIdLogical(Long id) {
        return goodsTypeService.deleteByIdLogical(id);
    }

    @Transactional(readOnly = true)
    public int removeById(GoodsType id) {
        return goodsTypeService.removeById(id);
    }

    @Transactional(readOnly = true)
    public int assignToOrgans(Assign2OrgansVO assign2Organs) {
        return goodsTypeService.assignToOrgans(assign2Organs);
    }


    public List<GoodsType> getGoodsTypeTree(GoodsType goodsType) {
        return goodsTypeService.getGoodsTypeTree(goodsType);
    }

    public Long getId() {
        return IdGenUtils.getNextLongId();
    }
}
